<div class="modal fade" tabindex="-1" role="dialog" id="carModal">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
            aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">添加客户信息</h4>
      </div>
      <div class="modal-body">
        <form id="fmCar" class="form-horizontal">
          <input type="hidden" name="id" value="0">
          <div class="form-group">
            <label class="col-sm-2 control-label">车牌号</label>
            <div class="col-sm-6">
              <input type="text" name="car_num" class="form-control" placeholder="车牌号">
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label">车型</label>
            <div class="col-sm-6">
              <input type="text" name="car_type" class="form-control" placeholder="车型">
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label">公里数</label>
            <div class="col-sm-6">
              <input type="text" name="mileage" class="form-control" placeholder="公里数">
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label">车架号</label>
            <div class="col-sm-6">
              <input type="text" name="vin" class="form-control" placeholder="车架号">
            </div>
          </div>

          <div class="form-group">
            <div class="col-sm-offset-3 col-sm-6">
              <a class="btn btn-default btnSubmit-hook">保存</a>
            </div>
          </div>
        </form>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
   $('#fmCar').find('.btnSubmit-hook').click(function(){
    var param=ittaoli.serializeObject($('#fmCar'));
    param.id=param.id==''?0:param.id;
    $.post("{:url('doAddCar')}",{param:JSON.stringify(param)},function(data){
      if(data.res>0){
        alert('保存成功');
        var html='<li>车牌号：'+param.car_num+'</li>';
        html+='<li>车型：'+param.car_type+'</li>';
        html+='<li>公里数：'+param.mileage+'</li>';
        html+='<li>车架号：'+param.vin+'</li>';
        invoiceModal.carNum='';
//        console.log(html);
        $('.info-vehicle-hook').html(html);
      }else{
        alert('保存失败');
      }
      $('#carModal').modal('hide');
    })
  });
</script>


